package vos
{
	import flash.net.SharedObject;
	import flash.utils.Dictionary;
	
	import mx.collections.ArrayCollection;
	
	[Bindable]
	public class RSSItem
	{
		public var author:String;
		public var description:String;
		public var link:String;
		public var title:String;
		public var pubDate:String;
		
		public var pictures:ArrayCollection;
				
		/* Gets the read state from a Dictionary at the local SharedObject storage */
		public function get read():Boolean
		{
			var sharedObject:Object = SharedObject.getLocal("readitems");
			if (sharedObject.data.readItems == null || link == null)
				return false;
			
			return (sharedObject.data.readItems[link] == "true");
		}
		
		/* Saves the read state in a Dictionary at the local SharedObject storage */
		public function set read(value:Boolean):void
		{
			var sharedObject:Object = SharedObject.getLocal("readitems");
			if (link == null)
			{
				return;
			}
			
			if (sharedObject.data.readItems == null)
			{
				sharedObject.data.readItems = new Dictionary();
			}
			
			if (value)
			{				
				sharedObject.data.readItems[link] = "true";
			}
			else
			{
				sharedObject.data.readItems[link] = "false";
			}
			
			sharedObject.flush();
		}
	}
}
